﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;

namespace JasRibbonApplicatie.Converters
{
    public class CalendarRedLetterConverter : IValueConverter
    {
        public static Dictionary<DateTime, string> dict = new Dictionary<DateTime, string>();

        static CalendarRedLetterConverter()
        {

        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string text ="";
            var results = dict.Where(d => ((DateTime) d.Key).Date == ((DateTime)value).Date);
            if (results.Count() > 0)
            {
                foreach (var r in results)
                {
                    text += ", " + r.Value;
                }
                return text.Substring(2);
            }
            else
            {
                return null;
            }
            
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }


    }
}
